#ifndef SOUND_H
#define SOUND_H

#include <Phonon/MediaObject>
#include <Phonon/AudioOutput>
#include <Phonon/MediaSource>
#include <QObject>
#include <QDir>
#include <QFileInfo>
#include <QFileInfoList>

class Sound : public QObject {
    Q_OBJECT

    public:
        Sound();

        static void initSounds();
        static void playSound(QString filename, double volume = 1.0);

        void setMusic(QString musicName, double volume = 1.0);
        void play();
        void pause();

        static bool soundEnabled();
        static bool musicEnabled();
        static void setSoundEnabled(bool b);
        static void setMusicEnabled(bool b);


        Phonon::AudioOutput *musicOutput;
        Phonon::MediaObject *musicObject;

    private:
        static QHash<QString, Phonon::MediaSource*> soundSources;
        static bool soundOn;
        static bool musicOn;

    private slots:
        void prepareMusicLoop();
};

#endif // SOUND_H
